
project(LandPlatform)




file(GLOB INCS inc/*.h)
file(GLOB HEADERS src/*.h)
file(GLOB SOURCES src/*.c)
add_library(liblp
    ${INCS}
    ${SOURCES}
    ${HEADERS}
    )

target_include_directories(liblp PRIVATE src)
target_include_directories(liblp PUBLIC inc)
if(BUILD_SHARED_LIBS)
    target_compile_definitions(liblp PUBLIC LP_EXPORTS)
endif()

if(LP_SOCKETPOLL_USE_SELECT)
    target_compile_definitions(liblp PUBLIC LP_SOCKETPOLL_USE_SELECT)
endif()

if(WIN32)
    target_compile_definitions(liblp PUBLIC WIN32)
    target_compile_definitions(liblp PRIVATE _CRT_SECURE_NO_WARNINGS)
    target_compile_definitions(liblp PRIVATE _CRT_NONSTDC_NO_DEPRECATE)
endif()

if(LINUX)
    target_compile_definitions(liblp PUBLIC LINUX)
    target_link_libraries(liblp PUBLIC pthread)
    target_link_libraries(liblp PUBLIC m)
    set_target_properties(liblp PROPERTIES COMPILE_FLAGS -std=gnu99)
endif()

if(APPLE)
    target_compile_definitions(liblp PUBLIC APPLE)
    target_link_libraries(liblp PUBLIC pthread)
endif()

